<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>await</title>
</head>
<body>
    <script>
        //创建promise 对象
        const p = new Promise((resolve,reject)=>{
            resolve("成功的值!");
        })

        // await 要放在 async 函数中
        async function main(){
           let result =  await p;
           console.log(result);
        }

        //调用函数
        main();
    </script>
    
</body>
</html>